/** ------------------------------------------------------------------------
    Append        : ReadModeEnum
    Purpose     : Enumeration of READ-*() method modes.
    Syntax      : 
    Description : 
    @author pjudge
    Created     : Tue Oct 12 14:26:03 EDT 2010
    Notes       : * Based on the ABL documentation
  ---------------------------------------------------------------------- */
routine-level on error undo, throw.

using OpenEdge.Lang.ReadModeEnum. 
using OpenEdge.Lang.EnumMember.

class OpenEdge.Lang.ReadModeEnum inherits EnumMember final: 
    
    define static public property Append as ReadModeEnum  no-undo get. private set.
    define static public property Empty as ReadModeEnum  no-undo get. private set.
    define static public property Merge as ReadModeEnum  no-undo get. private set.
    define static public property Replace as ReadModeEnum  no-undo get. private set.
    define static public property Default as ReadModeEnum  no-undo get. private set.
    
    constructor static ReadModeEnum():
        ReadModeEnum:Append = new ReadModeEnum('Append').
        ReadModeEnum:Empty = new ReadModeEnum('Empty').
        ReadModeEnum:Merge = new ReadModeEnum('Empty-Handle').
        ReadModeEnum:Replace = new ReadModeEnum('Replace').
        ReadModeEnum:Default = ReadModeEnum:Merge. 
    end constructor.
    
    constructor public ReadModeEnum(input pcName as character):
        super (input pcName).
    end constructor.     

    method static public ReadModeEnum EnumFromString(pcReadMode as character):
        define variable oMember as ReadModeEnum no-undo.
        
        case pcReadMode:
            when ReadModeEnum:Append:ToString()  then oMember = ReadModeEnum:Append.
            when ReadModeEnum:Empty:ToString()   then oMember = ReadModeEnum:Empty.
            when ReadModeEnum:Merge:ToString()   then oMember = ReadModeEnum:Merge.
            when ReadModeEnum:Replace:ToString() then oMember = ReadModeEnum:Replace.
        end case.
        
        return oMember.   
    end method.
end class.